package com.leadbank.springboot.example.dubbo.consumer.controller;

import com.leadbank.springboot.example.dubbo.provider.service.ComputeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by hp on 2018/1/8.
 */
@Controller
public class ComputeController {

    @Autowired
    private ComputeService computeService;

    @RequestMapping(value = "/compute/{a}/{b}")
    @ResponseBody
    public Integer index(@PathVariable String a, @PathVariable String b) {

        Integer result = computeService.add(Integer.valueOf(a), Integer.valueOf(b));

        return result;
    }
}
